class DetailsModel {
  int status;
  DetailsGoodsData data;
  String message;

  DetailsModel({this.status, this.data, this.message});

  DetailsModel.fromJson(Map<String, dynamic> json) {
    status = json['status'];
    data = json['data'] != null ? new DetailsGoodsData.fromJson(json['data']) : null;
    message = json['message'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['status'] = this.status;
    if (this.data != null) {
      data['data'] = this.data.toJson();
    }
    data['message'] = this.message;
    return data;
  }
}

class DetailsGoodsData {
  int id;
  int categoryId;
  String brandName;
  String seriesName;
  String modelName;
  String parameterText;
  String partNumber;
  int type;
  String url;
  String extract;
  String title;
  Null longTitle;
  String description;
  String image;
  int onSale;
  int rating;
  int soldCount;
  int reviewCount;
  String priceText;
  String price;
  int skuId;
  Category category;
  Null brand;
  Null series;
  List<Skus> skus;
  List<ProductAdv> productAdv;

  DetailsGoodsData(
      {this.id,
      this.categoryId,
      this.brandName,
      this.seriesName,
      this.modelName,
      this.parameterText,
      this.partNumber,
      this.type,
      this.url,
      this.extract,
      this.title,
      this.longTitle,
      this.description,
      this.image,
      this.onSale,
      this.rating,
      this.soldCount,
      this.reviewCount,
      this.priceText,
      this.price,
      this.skuId,
      this.category,
      this.brand,
      this.series,
      this.skus,
      this.productAdv});

  DetailsGoodsData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    categoryId = json['category_id'];
    brandName = json['brand_name'];
    seriesName = json['series_name'];
    modelName = json['model_name'];
    parameterText = json['parameter_text'];
    partNumber = json['part_number'];
    type = json['type'];
    url = json['url'];
    extract = json['extract'];
    title = json['title'];
    longTitle = json['long_title'];
    description = json['description'];
    image = json['image'];
    onSale = json['on_sale'];
    rating = json['rating'];
    soldCount = json['sold_count'];
    reviewCount = json['review_count'];
    priceText = json['price_text'];
    price = json['price'];
    skuId = json['sku_id'];
    category = json['category'] != null
        ? new Category.fromJson(json['category'])
        : null;
    brand = json['brand'];
    series = json['series'];
    if (json['skus'] != null) {
      skus = new List<Skus>();
      json['skus'].forEach((v) {
        skus.add(new Skus.fromJson(v));
      });
    }
    if (json['product_adv'] != null) {
      productAdv = new List<ProductAdv>();
      json['product_adv'].forEach((v) {
        productAdv.add(new ProductAdv.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['category_id'] = this.categoryId;
    data['brand_name'] = this.brandName;
    data['series_name'] = this.seriesName;
    data['model_name'] = this.modelName;
    data['parameter_text'] = this.parameterText;
    data['part_number'] = this.partNumber;
    data['type'] = this.type;
    data['url'] = this.url;
    data['extract'] = this.extract;
    data['title'] = this.title;
    data['long_title'] = this.longTitle;
    data['description'] = this.description;
    data['image'] = this.image;
    data['on_sale'] = this.onSale;
    data['rating'] = this.rating;
    data['sold_count'] = this.soldCount;
    data['review_count'] = this.reviewCount;
    data['price_text'] = this.priceText;
    data['price'] = this.price;
    data['sku_id'] = this.skuId;
    if (this.category != null) {
      data['category'] = this.category.toJson();
    }
    data['brand'] = this.brand;
    data['series'] = this.series;
    if (this.skus != null) {
      data['skus'] = this.skus.map((v) => v.toJson()).toList();
    }
    if (this.productAdv != null) {
      data['product_adv'] = this.productAdv.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Category {
  int id;
  String name;
  int parentId;
  bool isDirectory;
  int level;
  String path;
  int order;
  String createdAt;
  String updatedAt;

  Category(
      {this.id,
      this.name,
      this.parentId,
      this.isDirectory,
      this.level,
      this.path,
      this.order,
      this.createdAt,
      this.updatedAt});

  Category.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    parentId = json['parent_id'];
    isDirectory = json['is_directory'];
    level = json['level'];
    path = json['path'];
    order = json['order'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['parent_id'] = this.parentId;
    data['is_directory'] = this.isDirectory;
    data['level'] = this.level;
    data['path'] = this.path;
    data['order'] = this.order;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    return data;
  }
}

class Skus {
  int id;
  String title;
  String description;
  String price;
  int stock;
  int productId;
  String createdAt;
  String updatedAt;

  Skus(
      {this.id,
      this.title,
      this.description,
      this.price,
      this.stock,
      this.productId,
      this.createdAt,
      this.updatedAt});

  Skus.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    title = json['title'];
    description = json['description'];
    price = json['price'];
    stock = json['stock'];
    productId = json['product_id'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['title'] = this.title;
    data['description'] = this.description;
    data['price'] = this.price;
    data['stock'] = this.stock;
    data['product_id'] = this.productId;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    return data;
  }
}

class ProductAdv {
  int id;
  int productId;
  String image;
  String createdAt;
  String updatedAt;

  ProductAdv(
      {this.id, this.productId, this.image, this.createdAt, this.updatedAt});

  ProductAdv.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    productId = json['product_id'];
    image = json['image'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['product_id'] = this.productId;
    data['image'] = this.image;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    return data;
  }
}
// class DetailsModel {
//   int status;
//   String message;
//   DetailsGoodsData data;

//   DetailsModel({this.status, this.message, this.data});

//   DetailsModel.fromJson(Map<String, dynamic> json) {
//     status = json['status'];
//     message = json['message'];
//     data = json['data'] != null ? new DetailsGoodsData.fromJson(json['data']) : null;
//   }

//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//     data['status'] = this.status;
//     data['message'] = this.message;
//     if (this.data != null) {
//       data['data'] = this.data.toJson();
//     }
//     return data;
//   }
// }

// class DetailsGoodsData {
//   int goodsId;
//   int categoryId2;
//   int categoryId3;
//   int categoryId4;
//   int uid;
//   int goodsType;
//   int productState;
//   String goodsName;
//   int cateId;
//   String goodsNo;
//   int stockNum;
//   int seriesId;
//   int brandId;
//   String goodsModel;
//   String marketPrice;
//   String price;
//   String unit;
//   String coverImg;
//   String goodsDetail;
//   int shelfStatus;
//   String shelfTime;
//   String freight;
//   int isSpec;
//   String createTime;
//   List<GoodAdv> goodAdv;
//   String brandName;
//   String brandImg;
//   String seriesName;
//   List<Spec> spec;
//   int collected;

//   DetailsGoodsData(
//       {this.goodsId,
//       this.categoryId2,
//       this.categoryId3,
//       this.categoryId4,
//       this.uid,
//       this.goodsType,
//       this.productState,
//       this.goodsName,
//       this.cateId,
//       this.goodsNo,
//       this.stockNum,
//       this.seriesId,
//       this.brandId,
//       this.goodsModel,
//       this.marketPrice,
//       this.price,
//       this.unit,
//       this.coverImg,
//       this.goodsDetail,
//       this.shelfStatus,
//       this.shelfTime,
//       this.freight,
//       this.isSpec,
//       this.createTime,
//       this.goodAdv,
//       this.brandName,
//       this.brandImg,
//       this.seriesName,
//       this.spec,
//       this.collected});

//   DetailsGoodsData.fromJson(Map<String, dynamic> json) {
//     goodsId = json['goods_id'];
//     categoryId2 = json['category_id2'];
//     categoryId3 = json['category_id3'];
//     categoryId4 = json['category_id4'];
//     uid = json['uid'];
//     goodsType = json['goods_type'];
//     productState = json['product_state'];
//     goodsName = json['goods_name'];
//     cateId = json['cate_id'];
//     goodsNo = json['goods_no'];
//     stockNum = json['stock_num'];
//     seriesId = json['series_id'];
//     brandId = json['brand_id'];
//     goodsModel = json['goods_model'];
//     marketPrice = json['market_price'];
//     price = json['price'];
//     unit = json['unit'];
//     coverImg = json['cover_img'];
//     goodsDetail = json['goods_detail'];
//     shelfStatus = json['shelf_status'];
//     shelfTime = json['shelf_time'];
//     freight = json['freight'];
//     isSpec = json['is_spec'];
//     createTime = json['create_time'];
//     if (json['good_adv'] != null) {
//       goodAdv = new List<GoodAdv>();
//       json['good_adv'].forEach((v) {
//         goodAdv.add(new GoodAdv.fromJson(v));
//       });
//     }
//     brandName = json['brand_name'];
//     brandImg = json['brand_img'];
//     seriesName = json['series_name'];
//     if (json['spec'] != null) {
//       spec = new List<Spec>();
//       json['spec'].forEach((v) {
//         spec.add(new Spec.fromJson(v));
//       });
//     }
//     collected = json['collected'];
//   }

//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//     data['goods_id'] = this.goodsId;
//     data['category_id2'] = this.categoryId2;
//     data['category_id3'] = this.categoryId3;
//     data['category_id4'] = this.categoryId4;
//     data['uid'] = this.uid;
//     data['goods_type'] = this.goodsType;
//     data['product_state'] = this.productState;
//     data['goods_name'] = this.goodsName;
//     data['cate_id'] = this.cateId;
//     data['goods_no'] = this.goodsNo;
//     data['stock_num'] = this.stockNum;
//     data['series_id'] = this.seriesId;
//     data['brand_id'] = this.brandId;
//     data['goods_model'] = this.goodsModel;
//     data['market_price'] = this.marketPrice;
//     data['price'] = this.price;
//     data['unit'] = this.unit;
//     data['cover_img'] = this.coverImg;
//     data['goods_detail'] = this.goodsDetail;
//     data['shelf_status'] = this.shelfStatus;
//     data['shelf_time'] = this.shelfTime;
//     data['freight'] = this.freight;
//     data['is_spec'] = this.isSpec;
//     data['create_time'] = this.createTime;
//     if (this.goodAdv != null) {
//       data['good_adv'] = this.goodAdv.map((v) => v.toJson()).toList();
//     }
//     data['brand_name'] = this.brandName;
//     data['brand_img'] = this.brandImg;
//     data['series_name'] = this.seriesName;
//     if (this.spec != null) {
//       data['spec'] = this.spec.map((v) => v.toJson()).toList();
//     }
//     data['collected'] = this.collected;
//     return data;
//   }
// }

// class GoodAdv {
//   int goodsAdvId;
//   String goodsId;
//   String advImg;

//   GoodAdv({this.goodsAdvId, this.goodsId, this.advImg});

//   GoodAdv.fromJson(Map<String, dynamic> json) {
//     goodsAdvId = json['goods_adv_id'];
//     goodsId = json['goods_id'];
//     advImg = json['adv_img'];
//   }

//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//     data['goods_adv_id'] = this.goodsAdvId;
//     data['goods_id'] = this.goodsId;
//     data['adv_img'] = this.advImg;
//     return data;
//   }
// }

// class Spec {
//   int specId;
//   String specName;
//   List<SpecVal> specVal;

//   Spec({this.specId, this.specName, this.specVal});

//   Spec.fromJson(Map<String, dynamic> json) {
//     specId = json['spec_id'];
//     specName = json['spec_name'];
//     if (json['spec_val'] != null) {
//       specVal = new List<SpecVal>();
//       json['spec_val'].forEach((v) {
//         specVal.add(new SpecVal.fromJson(v));
//       });
//     }
//   }

//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//     data['spec_id'] = this.specId;
//     data['spec_name'] = this.specName;
//     if (this.specVal != null) {
//       data['spec_val'] = this.specVal.map((v) => v.toJson()).toList();
//     }
//     return data;
//   }
// }

// class SpecVal {
//   int specValueId;
//   String specValue;

//   SpecVal({this.specValueId, this.specValue});

//   SpecVal.fromJson(Map<String, dynamic> json) {
//     specValueId = json['spec_value_id'];
//     specValue = json['spec_value'];
//   }

//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//     data['spec_value_id'] = this.specValueId;
//     data['spec_value'] = this.specValue;
//     return data;
//   }
// }